package com.bole.feign;

import com.bole.data.Result;
import com.bole.dto.permission.RoleDto;
import com.bole.fallback.RoleFeignFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(value = "bolecar-backstage-service", fallback = RoleFeignFallback.class)
public interface RoleFeign {
    @GetMapping("/role")
    Result get();

//    @PostMapping("/role")
    @RequestMapping(value = "/role", method = RequestMethod.POST)
    Result add(@RequestBody RoleDto roleDo, @RequestParam("nodeIds") Long[] nodeIds);

    @GetMapping("/role/{id}")
    Result getRoleById(@PathVariable("id") Long id);

    @PutMapping("/role/{id}")
    Result updateById(@PathVariable("id") Long id, @RequestBody RoleDto role, @RequestParam("nodeIds") Long[] nodeIds);

    @DeleteMapping("/role/{id}")
    Result deleteById(@PathVariable("id") Long id);
}
